<%@ page language="java" import="java.util.*" pageEncoding="Utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加酒店图集</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/base.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/page.css" type="text/css" media="screen" />
<script src="${pageContext.request.contextPath}/common/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/common/js/common.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/common/js/swfupload/swfupload.js" type="text/javascript" ></script>
<script src="${pageContext.request.contextPath}/common/js/swfupload/fileprogress.js" type="text/javascript" ></script>
<script src="${pageContext.request.contextPath}/common/js/swfupload/myswf.js" type="text/javascript" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidator.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidatorregex.js"></script>
<script type="text/javascript">
	$(function(){
		$.formValidator.initConfig({formid:"addform",autotip:true});
		$("#picName").formValidator({onshow:"请输入图片名称",onfocus:"图片名称不能为空。"}).inputValidator({min:1,max:30,onerror:"图片名称不能多于30位。"});
		$("#sort").formValidator({onshow:"请输入排序",onfocus:"排序不能为空。"}).regexValidator({regexp:"num1",datatype:"enum",onerror:"请输入正确的排序"});
		});
	
</script>
<script type="text/javascript">
$(function(){
	myswf({'basepath':'${pageContext.request.contextPath}','type':'image','buttonholder':'spanButtonPlaceHolder','success':imageuploadsuc,'progresslist':'progress'});
});

function imageuploadsuc(data)
{
	var name=data.filename;
	var picName=$("#picName").val();
	if(picName==""){name=name.substring(0,name.lastIndexOf("."));
	$("#picName").val(name);}
	else{$("#picName").val(picName);}
	$("#swf_image").html('<input type="text" name="hotelPic.picUrl" id="picUrl" readonly="readonly"  class="tx5" value="'+data.url+'" onmousemove="mytoolTip(this)" onmouseout="mytoolTip()"/>');
}

function mytoolTip(url)
{
	if(!url)toolTip();
	else toolTip('<img src="${pageContext.request.contextPath}/'+$(url).val()+'">');
}
</script>
</head>
<body>

<div class="pd10">	
	<div class="listbox">
		<form id="addform" action="save.action" method="post">
			<div>
				<table class="addtab"  align="left">
					<tr>
						<th>图片名称</th>
						<td><input type="text" class="tx6" id="picName" name="hotelPic.picName"/></td>
					</tr>
					<tr>
						<th>酒店图片</th>
						<td><div id="swf_image"></div><input id="spanButtonPlaceHolder"/><div id="progress"></div>
						</td>
					</tr>	
					<tr>
						<th>排序</th>
						<td><input type="text" class="tx3" id="sort" name="hotelPic.sort" value="0"/></td>
					</tr>		
				</table>
			</div>
			<div class="hidden"><input id="addsubmit" type="submit"/></div>
		</form>
	</div>
</div>
<script src="${pageContext.request.contextPath}/common/js/ToolTip.js" type="text/javascript"></script>
</body>
</html>